<?php

// [ 投资机构 ]

namespace app\common\validate;
use think\Validate;

class Organization extends Validate
{
    // 验证规则
    protected $rule = [
        'title'        => 'require|length:2,40',
        'logo'         => 'require',
        'introduction' => 'max:1000',
        'status'       => 'require|integer|in:0,1',
    ];

    // 错误提示
    protected $message = [
        'title.require'        => '名称必须',
        'title.length'         => '名称长度[2~40]',
        
        'logo.require'         => 'LOGO必须',
        
        'introduction.require' => '简介最大长度[1000]',
        
        'status.require'       => '状态必须',
        'status.integer'       => '状态必须为数字',
        'status.in'            => '状态取值范围[0|1]',
    ];
    
    // 验证场景
    protected $scene = [
        // 新增投资机构
        'add'  => ['title','logo','introduction'],
        // 编辑投资机构
        'edit' => ['title','logo','introduction'],
    ];
}